import {reqImgInfo} from '@/api'

const state = {
  imginfo:[]
}
const mutations = {
  GETIMGINFO(state,imginfo){
    state.imginfo = imginfo
  }
}
const actions = {
  async getImgInfo({commit}){
    const res =await reqImgInfo()
    if(res.code = 200){
      commit('GETIMGINFO',res.data)
    }else{
      return Promise.reject();
    }
  }
}
const getters = {
  firstBanner(){
    return state.imginfo.firstBanner || []
  },
  shopGoods(){
    return state.imginfo.shopGoods || []
  },
  secBanner(){
    return state.imginfo.secBanner || []
  }
}

export default{
  state,
  mutations,
  actions,
  getters
}